﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="true" CodeFile="EditRoute.aspx.cs" Inherits="Admin_Package_EditRoute" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <style type="text/css">
        .gvTr
        {
            padding:60px;
            height:100px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="box">
        <h1>Edit Route</h1>

        <div class="oneline">
            <br />
            <asp:GridView ID="gvTransit" runat="server" AutoGenerateColumns="False" Width="100%" GridLines="None" CellPadding="4" ForeColor="#333333" 
                OnRowCommand="gvTransit_RowCommand" OnRowEditing="gvTransit_RowEditing" OnRowCancelingEdit="gvTransit_RowCancelingEdit" OnRowUpdating="gvTransit_RowUpdating" OnRowDeleting="gvTransit_RowDeleting">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:TemplateField HeaderText="Branch">
                        <ItemTemplate>
                            <asp:Label ID="lblBranchName"  runat="server" Text='<%# Bind("CurrentBranch") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="ddlBranch" runat="server" DataSource='<%# lstBranch %>' DataTextField="Name" DataValueField="ID" SelectedValue='<%# Bind("CurrentBranchID") %>'>
                            </asp:DropDownList>
                            <asp:HiddenField ID="hidID" runat="server" Value='<%# Eval("TransitID") %>' />
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Address" ItemStyle-Width="600px">
                        <ItemTemplate>
                            <asp:Label ID="lblAddress" runat="server" Text='<%# Eval("CurrentAddress") %>'></asp:Label>
                        </ItemTemplate>
                        <ItemStyle Width="400px"></ItemStyle>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Status">
                        <ItemTemplate>
                            <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status").ToString()=="1" ? "Arrived" : "Pending" %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ShowEditButton="True" ItemStyle-Width="50px"></asp:CommandField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnAdd" runat="server" CommandArgument='<%# Eval("TransitID") %>' CommandName="AddTransit" Text="Add Below"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("TransitID") %>' CommandName="DelTransit" Text="Delete" OnClientClick="return confirm('Do you confirm to delete?')"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>

                <EditRowStyle BackColor="#c8c8c8" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB"  CssClass="gvTr"  />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                
            </asp:GridView>
            <br />
            <asp:Panel ID="panelNew" runat="server" class="box_simple" Visible="false">
                <div class="oneline">
                    <div class="oneline">
                        <div class="name">Current Branch:</div>
                        <asp:Label ID="lblCurrentBranchName" runat="server"></asp:Label>
                    </div>
                    <table style="width: 100%;" cellpadding="1" cellspacing="2">
                        <tr>
                            <td>
                                <asp:DropDownList ID="ddlBranch" runat="server" DataSource='<%# lstBranch %>' DataTextField="Name" DataValueField="ID">
                                </asp:DropDownList></td>
                            <td style="width: 60%">
                                <asp:Label ID="lblCurrentBranchAddress" runat="server"></asp:Label></td>
                            <td style="width: 10%">
                                <asp:Label ID="lblCurrentBranchCountry" runat="server"></asp:Label></td>
                        </tr>
                    </table>
                    <asp:HiddenField ID="hidCurrentTransit" runat="server" />
                    <asp:LinkButton ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click"></asp:LinkButton>
                    <asp:LinkButton ID="btnCancel" runat="server" Text="Cancel" OnClick="btnCancel_Click"></asp:LinkButton>
                </div>
            </asp:Panel>
            <br />

        </div>
    </div>
</asp:Content>

